﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BasBarCodeInfo.aspx.cs" Inherits="JYH.Web.MES.BAS.UI.BasBarCodeInfo" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script type="text/javascript">

        let res = {};
        $(function () {
            $('.easyui-dialog').dialog({
                left: 100
            });
            // 修改抽屉的初始化
            $('#dd').drawer({
                onCollapse: function () {
                    console.log('抽屉已关闭');
                },
                onExpand: function () {
                    $(this).panel('panel').css('z-index', 9999);
                }
            });
            $('#s').on('dblclick', function () {
                $('#MaterialDialog').find('input.easyui-textbox').textbox('setValue', '');
                $('#MaterialDialog').dialog('open');
                MaterialLocal();
            });

            $('#sk').on('dblclick', function () {
                $('#PartnerDialog').find('input.easyui-textbox').textbox('setValue', '');
                $('#PartnerDialog').dialog('open');
                TPartnerLocal();
            })
            $('#tt').datagrid({
                loadMsg: "正在接收数据...",
                iconCls: 'icon-reload',
                idField: 'BarcodeID',
                autoRowHeight: true,
                fitColumns: false,
                scrollbarSize: 0,
                pageSize: 20,
                striped: true,      //隔行变色
                singleSelect: true, //是否单选
                pagination: true,   //分页控件
                rownumbers: true,
                columns: [[
                    { field: 'BarcodeID', checkbox: true },
                    { field: 'BarcodeNO', title: '条码编号', sortable: true, width: 150 },
                    { field: 'Qty', title: '包装数量', width: 70 },
                    { field: 'MaterialNO', title: '物料编号', width: 120 },
                    { field: 'MaterialName', title: '物料名称' },
                    { field: 'MaterialDesc', title: '物料规格' },
                    { field: 'BatchNO', title: '批号', width: 100 },
                    { field: 'ReciveOrderNO', title: '收料单号', width: 120 },
                    { field: 'ERPItem', title: '收料单号', width: 120 },
                    { field: 'PartnerNO', title: '供应商编号', width: 120 },
                    { field: 'PartnerName', title: '供应商名称' },
                    { field: 'CreateTime', title: '创建时间', sortable: true, width: 150 }
                ]],
                onLoadSuccess: function (data) {
                    $('#tt').datagrid("fillRows");
                    $('#tt').datagrid('resize');
                },
                onSortColumn: function (order, sort) {
                    $("#hSort").val(sort);
                    $("#hOrder").val(order);
                    /*      loadLocal();*/
                }
            });

            $('#tts').datagrid({
                loadMsg: "正在接收数据...",
                iconCls: 'icon-reload',
                url: '',
                idField: 'MaterialID',
                autoRowHeight: false,
                fitColumns: false,
                scrollbarSize: 0,
                height: document.documentElement.clientHeight - 250,
                pageSize: 20,
                sortable: true,
                striped: true,      //隔行变色
                singleSelect: true, //是否单选
                pagination: true,   //分页控件  
                rownumbers: true,
                columns: [[
                    { field: 'IsSelect', checkbox: true },
                    { field: 'MaterialID', hidden: true },
                    //{ field: 'MaterialType', hidden: true },
                    { field: 'MaterialNO', width: 150, title: '物料编号', sortable: true },
                    { field: 'MaterialName', width: 250, title: '物料名称' },
                    { field: 'MaterialDesc', width: 350, title: '物料规格' }


                ]],
                onDblClickRow: function (index, row) {
                    if (row == null) {
                        Alert("请选择一行数据");
                        return false;
                    }
                    $('#hMaterialID').val(row.MaterialID);
                    $("#tMaterialNO").textbox('setValue', row.MaterialNO);
                    $("#tMaterialName").textbox('setValue', row.MaterialName);
                    $("#tMaterialDesc").textbox('setValue', row.MaterialDesc);
                    $('#MaterialDialog').dialog('close');
                },
                loadFilter: function (data) {
                    if (data.d) {
                        return data.d;
                    } else {
                        return JSON.parse(data);
                    }

                }

            });

            //BasPartnerInfo
            $('#ttsd').datagrid({
                loadMsg: "正在接收数据...",
                iconCls: 'icon-reload',
                url: '',
                idField: 'PartnerID',
                autoRowHeight: false,
                fitColumns: false,
                scrollbarSize: 0,
                height: document.documentElement.clientHeight - 250,
                pageSize: 20,
                sortable: true,
                striped: true,      //隔行变色
                singleSelect: true, //是否单选
                pagination: true,   //分页控件  
                rownumbers: true,
                columns: [[
                    {
                        field: 'PartnerID', // 复选框字段
                        checkbox: true // 表示这是一个复选框列
                    },
                    { field: 'PartnerNO', title: '伙伴编号', width: 150 },
                    { field: 'PartnerName', title: '伙伴名称', width: 350 },
                    { field: 'PartnerCode', title: '伙伴代码', width: 150 }

                ]],
                onDblClickRow: function (index, row) {
                    if (row == null) {
                        Alert("请选择一行数据");
                        return false;
                    }
                    $('#hPartnerID').val(row.PartnerID);
                    $("#tPartnerNO").textbox('setValue', row.PartnerNO);
                    $("#tPartnerName").textbox('setValue', row.PartnerName);
                    $('#PartnerDialog').dialog('close');
                },
                loadFilter: function (data) {
                    if (data.d) {
                        return data.d;
                    } else {
                        return JSON.parse(data);
                    }

                }

            });

            //WmsReciveItem
            $('#SL').datagrid({
                loadMsg: "正在接收数据...",
                iconCls: 'icon-reload',
                url: '',
                idField: 'ReciveItemID',
                autoRowHeight: false,
                fitColumns: false,
                scrollbarSize: 0,
                height: document.documentElement.clientHeight - 280,
                pageSize: 10,
                sortable: true,
                striped: true,      //隔行变色
                singleSelect: false, //是否单选
                pagination: true,   //分页控件  
                rownumbers: true,
                columns: [[
                    {
                        field: 'ReciveItemID', // 复选框字段
                        checkbox: true // 表示这是一个复选框列
                    },
                    {
                        field: 'ReciveOrderID',
                        hidden: true
                    },
                    {
                        field: 'PartnerID',
                        hidden: true
                    },
                    {
                        field: 'MaterialID',
                        hidden: true
                    },

                    { field: 'ReciveOrderNO', title: '收料单号', with: 120, sortable: true },
                    { field: 'ERPItem', title: '收料项次', with: 80, sortable: true },
                    { field: 'ReciveQty', title: '收料数量' },
                    { field: 'LabelQty', title: '未生成数量' },
                    { field: 'PackQty', title: '最小包装' },
                    { field: 'MaterialNO', title: '物料编号', with: 120 },
                    { field: 'MaterialName', title: '物料名称', with: 200 },
                    { field: 'MaterialDesc', title: '物料规格' },
                    { field: 'BatchNO', title: '批号' },
                    { field: 'PartnerNO', title: '伙伴编号' },
                    { field: 'PartnerName', title: '伙伴名称' },
                    { field: 'Humidity', hidden: true }
                ]],
                onDblClickRow: function (index, row) {
                    if (row == null) {
                        Alert("请选择一行数据");
                        return false;
                    }
                    $('#hPartnerID').val(row.PartnerID);
                    $('#hMaterialID').val(row.MaterialID);
                    $('#hReciveItemID').val(row.ReciveItemID);

                    $('#dd').find('input.easyui-textbox').textbox('setValue', '');
                    $("#tPartnerNO").textbox('setValue', row.PartnerNO);
                    $("#tPartnerName").textbox('setValue', row.PartnerName);
                    $("#tMaterialNO").textbox('setValue', row.MaterialNO);
                    $("#tMaterialName").textbox('setValue', row.MaterialName);
                    $("#tMaterialDesc").textbox('setValue', row.MaterialDesc);
                    $("#tHumidity").textbox('setValue', row.Humidity);
                    $("#tBatchNO").textbox('setValue', row.BatchNO);
                    $('#tQty').textbox('setValue', row.ReciveQty);
                    if (row.PackQty == 0)
                        $("#tPackQty").textbox('setValue', row.ReciveQty);
                    else
                        $("#tPackQty").textbox('setValue', row.PackQty);

                    $('#SLDialog').dialog('close');

                    $('#dd').drawer('expand');

                },
                loadFilter: function (data) {
                    if (data.d) {
                        return data.d;
                    } else {
                        return JSON.parse(data);
                    }

                }

            });

            //标签打印 补打
            $('#barCode').datagrid({
                loadMsg: "正在接收数据...",
                iconCls: 'icon-reload',
                url: '',
                idField: 'BarcodeID',
                autoRowHeight: false,
                fitColumns: false,
                scrollbarSize: 0,
                height: document.documentElement.clientHeight - 280,
                pageSize: 10,
                sortable: true,
                striped: true,      //隔行变色
                singleSelect: false, //是否单选
                pagination: true,   //分页控件  
                rownumbers: true,
                columns: [[
                    { field: 'BarcodeID', title: '条码ID', checkbox: true },
                    { field: 'BarcodeNO', title: '物料条码', sortable: true },
                    { field: 'Qty', title: '包装数量' },
                    { field: 'MaterialNO', title: '物料编号' },
                    { field: 'MaterialName', title: '物料名称' },
                    { field: 'MaterialDesc', title: '包装规格' },
                    { field: 'BatchNO', title: '批号' },
                    { field: 'ReciveOrderNO', title: '收料单号' },
                    { field: 'ERPItem', title: '收料项次' },
                    { field: 'PartnerNO', title: '供应商编号' },
                    { field: 'PartnerName', title: '供应商名称' },
                    { field: 'CreateTime', title: '创建时间', sortable: true }
                ]],
                onLoadSuccess: function (data) {
                    $('#barCode').datagrid("fillRows");
                    $('#barCode').datagrid('resize');
                },
                onSortColumn: function (order, sort) {
                    $("#hSort").val(sort);
                    $("#hOrder").val(order);
                    /*     loadLocal();*/
                }
            });
        })

        //批号默认生成
        function BatchData() {

            // 获取当前文本框的值
            var currentValue = $('#tBatchNO').textbox('getValue');

            // 如果当前没有值或者值为空字符串，则设置默认值
            if (!currentValue || currentValue.trim() === '') {
                var today = new Date();
                var yyyy = today.getFullYear();
                var mm = String(today.getMonth() + 1).padStart(2, '0');
                var dd = String(today.getDate()).padStart(2, '0');
                var formattedDate = yyyy + mm + dd;
                $('#tBatchNO').textbox('setValue', formattedDate);
            }
            // 如果已经有值，则不做任何修改
        }
        //新增取消
        function ItemClear() {
            $('#dd').drawer({
                onCollapse: function () {
                    // 抽屉关闭后的逻辑处理
                    console.log('抽屉已关闭');
                    // 添加您想要执行的操作
                }
            });

        }
        //标签新增保存
        function ItemSave() {
            MessagerProgress("正在生成条码");
            if (!validateForm()) {
                return;
            }
            var Qty = $('#tQty').textbox('getValue');
            var Quantity = $('#tQuantity').textbox('getValue');
            if (!Quantity)
                Quantity = 0;
            var PackQty = $('#tPackQty').textbox('getValue');
            if (!PackQty)
                PackQty = Qty;

            if (parseFloat(PackQty) > parseFloat(Qty)) {
                Alert("包装数量不能大于条码数量");
                return false;
            }
            var PartnerInfo = {
                MaterialID: $('#hMaterialID').val(),
                PartnerID: $('#hPartnerID').val(),
                Quantity: parseFloat(Quantity),
                Qty: parseFloat(Qty),
                PackQty: parseFloat(PackQty),
                Humidity: $("#tHumidity").textbox('getValue'),
                BatchNO: $("#tBatchNO").textbox('getValue'),
                ReciveItemID: $('#hReciveItemID').val()
            };
            // 创建一个 List（数组）并添加对象
            var list = [];
            list.push(PartnerInfo);
            var url = '/api/BAS/SaveBarcodeInfo';
            DataService.PostJson(url, list, function (err, res) {
                if (err) {
                    Notice("保存成功!");
                    console.log(res);
                    loadLocal();

                } else {
                    Alert("保存失败." + JSON.parse(res).Message);
                }
            });
            ItemClear();
            // 关闭进度条
            MessagerProClose();
        }

        //查询条码
        function loadLocal() {
            var BarcodeNO = $("#qBarcodeNO").val();//编号
            var MaterialNO = $("#qMaterialNO").val();//编号
            var ReciveOrderNO = $("#qReciveOrderNO").val();
            //var CustomOrderNO = $("#qCustomOrderNO").val();//名称
            //排序字段
            var sort = $("#hSort").val();
            var order = $("#hOrder").val();
            $("#tt").datagrid({
                url: '/api/BAS/QueryBarcodeInfo',
                method: 'Get',
                queryParams: {
                    BarcodeNO: BarcodeNO,
                    MaterialNO: MaterialNO,
                    ReciveOrderNO: ReciveOrderNO,
                    sort: sort,
                    order: order
                },
                loadFilter: function (data) {
                    if (data.d) {
                        return data.d;
                    } else {
                        return JSON.parse(data);
                    }

                }
            });
            $('#tt').datagrid('unselectAll');
        }
        //MaterialLocalLocal
        function MaterialLocal() {
            var MaterialNO = $("#DMaterialNO").val();
            var MaterialName = $("#DMaterialName").val();
            $("#tts").datagrid({
                url: '/api/BAS/QueryMaterial',
                method: 'Get',
                queryParams: {
                    MaterialNO: MaterialNO,
                    MaterialName: MaterialName,
                    order: '',
                    sort: ''
                },
                loadFilter: function (data) {
                    if (data.d) {
                        return data.d;
                    } else {
                        return JSON.parse(data);
                    }

                }
            });
        }

        //SLLocalLocal
        function SLLocal() {
            var ReciveOrderNO = $("#SReciveOrderNO").val();
            var PartnerNO = $("#SPartnerNO").val();
            $("#SL").datagrid({
                url: '/api/WMS/QueryMaterial_label',
                method: 'Get',
                queryParams: {
                    ReciveOrderNO: ReciveOrderNO,
                    PartnerNO: PartnerNO,
                    order: '',
                    sort: ''
                },
                loadFilter: function (data) {
                    if (data.d) {
                        return data.d;
                    } else {
                        return JSON.parse(data);
                    }

                }
            });
        }
        //TPartnerLocal
        function TPartnerLocal() {
            var PartnerNO = $("#DPartnerNO").val();//编号
            var PartnerName = $("#DPartnerName").val();//名称
            $("#ttsd").datagrid({
                url: '/api/BAS/QueryPartner',
                method: 'Get',
                queryParams: {
                    PartnerNO: PartnerNO,
                    PartnerName: PartnerName,
                    order: '',
                    sort: ''
                },
                loadFilter: function (data) {
                    if (data.d) {
                        return data.d;
                    } else {
                        return JSON.parse(data);
                    }

                }
            });
        }
        //新增弹窗
        function IndexOpen() {
            $('#hPartnerID').val("");
            $('#hMaterialID').val("");
            $('#hReciveItemID').val("");
            document.getElementById('BtnSave').style.display = '';//inline
            $('#dd').find('input.easyui-textbox').textbox('setValue', '');
            BatchData();
            $('#dd').drawer('expand');
        }
        //收料单标签弹窗
        function LableCode() {

            $('#SLDialog').find('input.easyui-textbox').textbox('setValue', '');

            $('#SLDialog').dialog('open');


        }
        //标签自动生成
        function Auto_Lable() {
            $.messager.confirm('确认', '确定要批量生成条码吗？', function (r) {
                if (r) {
                    MessagerProgress("正在生成条码");
                    // 获取所有选中的行
                    var selectedRows = $('#SL').datagrid('getSelections');
                    var RePush = [];
                    for (var i = 0; i < selectedRows.length; i++) {
                        RePush.push({
                            MaterialID: selectedRows[i].MaterialID,
                            PartnerID: selectedRows[i].PartnerID,
                            Quantity: 0,
                            Qty: selectedRows[i].ReciveQty,
                            PackQty: selectedRows[i].PackQty == 0 ? selectedRows[i].ReciveQty : selectedRows[i].PackQty,
                            Humidity: selectedRows[i].Humidity, // 修正
                            BatchNO: selectedRows[i].BatchNO,
                            ReciveItemID: selectedRows[i].ReciveItemID
                        });
                    }
                    var url = '/api/BAS/SaveBarcodeInfo';
                    DataService.PostJson(url, RePush, function (err, res) {

                        if (err) {
                            Notice("保存成功!");
                            SLLocal();
                        } else {
                            Alert("保存失败." + JSON.parse(res).Message);
                        }
                    });
                    // 关闭进度条
                    MessagerProClose();
                }
            })
        }
        //标签选中生成条码
        function PrintOne(printQty) {
            $('#hPrint').val(printQty);
            // 重置数据网格
            CodeLocal();
            $('#barCode').datagrid('unselectAll');
            $('#CodeDialog').find('input.easyui-textbox').textbox('setValue', '');
            $('#CodeDialog').dialog('open');
        }

        //标签打印
        function Print_Lable() {

            var row = $('#barCode').datagrid('getSelections');
            var ids = "";
            if (row.length > 0) {
                for (var i = 0; i < row.length; i++) {
                    ids += "" + row[i]["BarcodeID"] + ",";
                }
            }
            else {
                Alert("请选择后打印.");
                return;
            }
            // 构建查询字符串
            var queryString = {
                printQty: $('#hPrint').val(),
                CodeID: ids,
                FormID: 1
            }
            const params = encodeURIComponent(JSON.stringify(queryString))

            //return OpenSubSubWindow("条码打印", "/Public/UI/ReportPrint.aspx?PrintName=PrintMaterialBarcode&QueryName=" + params, 650, 450,
            //    function () {
            //        $('#tt').datagrid('unselectAll');
            //        if ($('#hPrint').val() == 0) {
            //            CodeLocal();
            //        }
            //        else {
            //            $('#barCode').datagrid('unselectAll');
            //        }
            //    })

            return OpenSubSubWindow("条码打印", "/BAS/UI/BasPrintBarCode.html?params=" + params, 650, 450,
                function () {
                    $('#tt').datagrid('unselectAll');
                    if ($('#hPrint').val() == 0) {
                        CodeLocal();
                    }
                    else {
                        $('#barCode').datagrid('unselectAll');
                    }
                })
        }

        //条码查询
        function CodeLocal() {
            var BarcodeNO = $("#FBarcodeNO").val();     // 条码编号
            var PartnerNO = $("#FPartnerNO").val();       // 供应商编号
            var SourceOrderNO = $("#FSourceOrderNO").val(); // 收料单号
            var MaterialNO = $("#FMaterialNO").val();     // 物料编号
            var MaterialName = $("#FMaterialName").val(); // 物料名称
            //var CustomOrderNO = $("#qCustomOrderNO").val();//名称
            //排序字段
            var sort = $("#hSort").val();
            var order = $("#hOrder").val();
            $("#barCode").datagrid({
                url: '/api/BAS/Query_PrintBarcodeInfo',
                method: 'Get',

                queryParams: {
                    BarcodeNO: BarcodeNO,
                    MaterialNO: MaterialNO,
                    PartnerNO: PartnerNO,
                    SourceOrderNO: SourceOrderNO,
                    MaterialName: MaterialName,
                    printQty: $('#hPrint').val(),
                    sort: sort,
                    order: order
                },
                loadFilter: function (data) {
                    return data.d ? data.d : JSON.parse(data);
                }
            });
            $('#barCode').datagrid('unselectAll');
        }

        async function TranslationPage() {

            try {
                var lang = {
                    PageName: 'MaterialBarocde',
                    LanguageNO: navigator.language
                };

                var url = "/api/SYS/GetPageLanguage";

                // var element = document.getElementById("Literal1");

                let c = await $.ajax({
                    url: url, // 替换为你的API或服务器端点
                    type: 'POST', // 或者 'POST'，取决于你的请求类型
                    data: lang,
                    contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                    success: function (data) {
                        console.log(JSON.stringify(data));
                        // 假设你需要在请求成功后显示元素
                        if (data.Code == 200) {

                            res = data.Items[0];
                            console.log(JSON.stringify(res));
                            if (res != null) {

                                document.title = res.PageTitile;


                                $('#BtnSearch').linkbutton({
                                    text: res.BtnSearch
                                });
                                $('#BtnAddNew').linkbutton({
                                    text: res.BtnAddNew
                                });
                                $('#BtnRecive').linkbutton({
                                    text: res.BtnRecive
                                });
                                $('#BtnPrint').linkbutton({
                                    text: res.BtnPrint
                                });
                                $('#BtnReprint').linkbutton({
                                    text: res.BtnReprint
                                });
                                $('#BtnSave').linkbutton({
                                    text: res.BtnSave
                                });
                                $('#BtnCancle').linkbutton({
                                    text: res.BtnCancle
                                });
                                $('#FPrint').linkbutton({
                                    text: res.BtnPrint
                                });
                                $('#FSearch').linkbutton({
                                    text: res.BtnSearch
                                });
                                $('#Dsearch').linkbutton({
                                    text: res.BtnSearch
                                });
                                $('#DMSearch').linkbutton({
                                    text: res.BtnSearch
                                });
                                $('#SLSearch').linkbutton({
                                    text: res.BtnSearch
                                });
                                $('#SLSave').linkbutton({
                                    text: res.BtnSave
                                });
                                $('#qBarcodeNO').textbox({
                                    prompt: res.BarcodeNO

                                });


                                $('#qMaterialNO').textbox({
                                    prompt: res.TxtMaterialNO,
                                });
                                $('#qReciveOrderNO').textbox({
                                    prompt: res.ReciveOrderNO,


                                });
                                $('#tMaterialNO').textbox({
                                    prompt: res.DClick,
                                    label: res.TxtMaterialNO

                                });
                                $('#tBatchNO').textbox({
                                    label: res.BatchNO

                                });
                                $('#tMaterialName').textbox({
                                    label: res.MaterialName

                                });
                                $('#tMaterialDesc').textbox({
                                    label: res.MaterialDesc

                                });
                                $('#tPartnerNO').textbox({
                                    prompt: res.DClick,
                                    label: res.VendorNO

                                });
                                $('#SReciveOrderNO').textbox({
                                    prompt: res.TxtSourceOrderNO



                                });
                                $('#SPartnerNO').textbox({
                                    prompt: res.VendorNO


                                });
                                $('#tPartnerName').textbox({
                                    label: res.VendorName

                                });
                                $('#tQuantity').textbox({
                                    label: res.TxtCopies

                                });
                                $('#tQty').textbox({
                                    label: res.TxtPartQty

                                });
                                $('#tHumidity').textbox({
                                    label: res.TxtHumidity

                                });
                                $('#tPackQty').textbox({
                                    label: res.PackQty

                                });


                                $('#FBarcodeNO').textbox({
                                    label: res.TxtBarcodeNO

                                });


                                $('#FMaterialNO').textbox({
                                    label: res.TxtMaterialNO

                                });
                                $('#DMaterialNO').textbox({
                                    label: res.TxtMaterialNO,
                                    prompt: res.MaterialNO

                                });

                                $('#DMaterialName').textbox({
                                    label: res.MaterialName,
                                    prompt: ''

                                });
                                $('#FMaterialName').textbox({
                                    label: res.MaterialName

                                });
                                $('#FPartnerNO').textbox({
                                    label: res.VendorNO

                                });
                                $('#FSourceOrderNO').textbox({
                                    label: res.TxtSourceOrderNO

                                });
                                $('#DPartnerNO').textbox({
                                    label: res.VendorNO,
                                    prompt: ''
                                });
                                $('#DPartnerName').textbox({
                                    label: res.VendorName,
                                    prompt: ''

                                });
                                $('#tt').datagrid('options').columns[0][0].title = res.TxtBarcodeNO;
                                $('#tt').datagrid('options').columns[0][1].title = res.TxtBarcodeNO;
                                $('#tt').datagrid('options').columns[0][2].title = res.PackQty;
                                $('#tt').datagrid('options').columns[0][3].title = res.TxtMaterialNO;
                                $('#tt').datagrid('options').columns[0][4].title = res.MaterialName;
                                $('#tt').datagrid('options').columns[0][5].title = res.MaterialDesc;
                                $('#tt').datagrid('options').columns[0][6].title = res.BatchNO;
                                $('#tt').datagrid('options').columns[0][7].title = res.ReciveOrderNO;
                                $('#tt').datagrid('options').columns[0][8].title = res.ERPItem;
                                $('#tt').datagrid('options').columns[0][9].title = res.VendorNO;
                                $('#tt').datagrid('options').columns[0][10].title = res.VendorName;
                                $('#tt').datagrid('options').columns[0][11].title = res.TxtCreateTime;
                                $('#tt').datagrid('options').title = res.BarcodeList;
                                $('#tt').datagrid('resize');
                                $('#tt').datagrid();

                                $('#barCode').datagrid('options').columns[0][0].title = res.TxtBarcodeNO;
                                $('#barCode').datagrid('options').columns[0][1].title = res.TxtBarcodeNO;
                                $('#barCode').datagrid('options').columns[0][2].title = res.PackQty;
                                $('#barCode').datagrid('options').columns[0][3].title = res.TxtMaterialNO;
                                $('#barCode').datagrid('options').columns[0][4].title = res.MaterialName;
                                $('#barCode').datagrid('options').columns[0][5].title = res.MaterialDesc;
                                $('#barCode').datagrid('options').columns[0][6].title = res.BatchNO;
                                $('#barCode').datagrid('options').columns[0][7].title = res.ReciveOrderNO;
                                $('#barCode').datagrid('options').columns[0][8].title = res.ERPItem;
                                $('#barCode').datagrid('options').columns[0][9].title = res.VendorNO;
                                $('#barCode').datagrid('options').columns[0][10].title = res.VendorName;
                                $('#barCode').datagrid('options').columns[0][11].title = res.TxtCreateTime;
                                $('#barCode').datagrid('options').title = res.BarcodeList;
                                $('#barCode').datagrid('resize');
                                $('#barCode').datagrid();

                                $('#ttsd').datagrid('options').columns[0][1].title = res.VendorNO;
                                $('#ttsd').datagrid('options').columns[0][2].title = res.VendorName;
                                $('#ttsd').datagrid('options').columns[0][3].title = res.PartnerCode;
                                $('#ttsd').datagrid('resize');
                                $('#tts').datagrid('options').columns[0][2].title = res.TxtMaterialNO;
                                $('#tts').datagrid('options').columns[0][3].title = res.MaterialName;
                                $('#tts').datagrid('options').columns[0][4].title = res.MaterialDesc;
                                $('#tts').datagrid('resize');
                                $('#tts').datagrid();

                                $('#SL').datagrid('options').columns[0][4].title = res.TxtSourceOrderNO;
                                $('#SL').datagrid('options').columns[0][5].title = res.ERPItem;
                                $('#SL').datagrid('options').columns[0][6].title = res.ReciveQty;
                                $('#SL').datagrid('options').columns[0][7].title = res.TxtLabelQty;
                                $('#SL').datagrid('options').columns[0][8].title = res.TxtMPackQty;
                                $('#SL').datagrid('options').columns[0][9].title = res.TxtMaterialNO;
                                $('#SL').datagrid('options').columns[0][10].title = res.MaterialName;
                                $('#SL').datagrid('options').columns[0][11].title = res.MaterialDesc;
                                $('#SL').datagrid('options').columns[0][12].title = res.BatchNO;
                                $('#SL').datagrid('options').columns[0][13].title = res.VendorNO;
                                $('#SL').datagrid('options').columns[0][14].title = res.VendorName;
                                $('#SL').datagrid('resize');
                                $('#SL').datagrid();



                                // document.querySelector('input[type="qBarcodeNO"]').setAttribute('data-options', 'Input Barcode NO');;

                            }
                        }
                        if (data.Code == 500) {

                            console.log(JSON.stringify(data));
                            Notice(data.Message);

                        }

                    },
                    error: function (xhr, status, error) {
                        // 错误处理
                    }
                });



            } catch (error) { }
            //  console.error('Request error:', error);

        };

        $(document).ready(function () {
            TranslationPage();
        }
        );


    </script>
</head>
<body>
    <div class="pagebox">
        <div class="cbox">
            <!--工具栏-->
            <div class="easyui-panel" style="padding: 15px; width: 100%;">
                <div id="tb">
                    <ul class="flist">
                        <li>
                            <input class="easyui-textbox" type="text" id="qBarcodeNO" data-options="prompt:'请输入条码编号'" style="width: 250px; height: 35px; line-height: 35px;" /></li>
                        <li>
                            <input class="easyui-textbox" type="text" id="qMaterialNO" data-options="prompt:'请输入物料料号'" style="width: 250px; height: 35px; line-height: 35px;" /></li>
                        <li>
                            <input class="easyui-textbox" type="text" id="qReciveOrderNO" data-options="prompt:'请输入收料单号'" style="width: 250px; height: 35px; line-height: 35px;" /></li>

                    </ul>
                    <div>
                        <a href="javascript:void(0)" class="easyui-linkbutton c1" onclick="loadLocal()" data-options="iconCls:'icon-sousuo',selected:true" id="BtnSearch">查询</a>
                        <a href="#" class="easyui-linkbutton c4" data-options="iconCls:'icon-tianjia'" onclick="IndexOpen()" id="BtnAddNew">新增</a>
                        <%--  <a href="#" class="easyui-linkbutton c7" iconcls="icon-print" plain="true" runat="server" id="saveT" onclick="PrintCode()">条码打印</a>--%>
                        <a href="#" class="easyui-linkbutton c7" data-options="iconCls:'icon-biaodan'" onclick="LableCode()" id="BtnRecive">收料标签</a>
                        <a href="#" class="easyui-linkbutton c7" iconcls="icon-print" plain="true" runat="server" onclick="PrintOne(0)" id="BtnPrint">标签打印</a>
                        <a href="#" class="easyui-linkbutton c7" iconcls="icon-baocun" plain="true" runat="server" onclick="PrintOne(1)" id="BtnReprint">标签补打</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="cbox">
            <!--查询结果清单-->
            <table id="tt" title="Barcode List">
            </table>
        </div>
    </div>

    <form id="ff" runat="server">
        <asp:HiddenField runat="server" ID="hSort" />
        <asp:HiddenField runat="server" ID="hOrder" />
        <asp:HiddenField runat="server" ID="hMaterialID" />
        <asp:HiddenField runat="server" ID="hPartnerID" />
        <asp:HiddenField runat="server" ID="hReciveItemID" />
        <%-- 0 打印 1 补打</p>--%>
        <asp:HiddenField runat="server" ID="hPrint" />
        <div id="dd" class="easyui-drawer f-column" style="width: 550px;">
            <div style="line-height: 30px; text-align: center; border-bottom: 1px solid #ddd">物料条码新增</div>
            <div class="f-full">

                <ul style="margin: 10px;">

                    <li style="margin-bottom: 15px; padding-left: 10px;" id="s">
                        <input class="easyui-textbox" id="tMaterialNO" style="width: 45%; height: 32px;" data-options="label:'物料编号:',prompt:'双击获取'" runat="server" required="required" />
                        &nbsp&nbsp&nbsp&nbsp
                     <input class="easyui-textbox" id="tBatchNO" style="width: 45%; height: 32px;" data-options="label:'物料批号:'" runat="server" required="required" />
                    </li>
                    <li style="margin-bottom: 15px; padding-left: 10px;">
                        <input class="easyui-textbox" id="tMaterialName" style="width: 95%; height: 32px;" data-options="label:'物料名称:'" runat="server" readonly="true" />
                    </li>
                    <li style="margin-bottom: 15px; padding-left: 10px;">
                        <input class="easyui-textbox" id="tMaterialDesc" style="width: 95%; height: 32px;" data-options="label:'物料规格:'" readonly="true" />
                    </li>
                    <li style="margin-bottom: 15px; padding-left: 10px;" id="sk">
                        <input class="easyui-textbox" id="tPartnerNO" style="width: 45%; height: 32px;" data-options="label:'供应商编号:',prompt:'双击获取'" runat="server" />
                        &nbsp&nbsp&nbsp&nbsp
                       <input class="easyui-textbox" id="tQty" style="width: 45%; height: 32px;" data-options="label:'条码数量:'" runat="server" inputmode="numeric" type="number" value="1" required="required" />
                    </li>
                    <li style="margin-bottom: 15px; padding-left: 10px;">
                        <input class="easyui-textbox" id="tPartnerName" style="width: 95%; height: 32px;" data-options="label:'供应商名称:'" readonly="true" />
                    </li>
                    <li style="margin-bottom: 15px; padding-left: 10px;">
                        <input class="easyui-textbox" id="tHumidity" style="width: 95%; height: 32px;" data-options="label:'湿敏等级:'" readonly="true" />
                    </li>
                    <li style="margin-bottom: 15px; padding-left: 10px;">
                        <input class="easyui-textbox" id="tPackQty" style="width: 45%; height: 32px;" data-options="label:'包装数量:'" runat="server" inputmode="numeric" type="number" value="1" />
                        &nbsp&nbsp&nbsp&nbsp
                        <input class="easyui-textbox" id="tQuantity" style="width: 45%; height: 32px;" data-options="label:'生成份数:',prompt:'Auto'" runat="server" inputmode="numeric" type="number" value="1" />
                    </li>

                </ul>
                <div style="padding: 10px;">
                    <span class="tip-text" style="font-size: 12px; color: #888;">提示： 当包装数量为空,自动生成份数=条码数量/包装数量(包装数量不输入自动等于条码数量)。自动向上取整。
                    </span>
                </div>
            </div>
            <div style="padding: 5px; text-align: center; border-top: 1px solid #ddd">
                <a href="javascript:;" id="BtnSave" class="easyui-linkbutton c1" onclick="ItemSave()">标签生成</a>
                <a href="javascript:;" class="easyui-linkbutton" id="BtnCancle" onclick="ItemClear()">取消</a>
            </div>
        </div>
    </form>

    <%--    物料检索dialog--%>
    <div id="MaterialDialog" class="easyui-dialog" title="Part List" style="width: 700px; height: 560px; padding: 5px" data-options="closed:true,modal:true">
        <div class="cbox">
            <ul class="flist">
                <li>
                    <input class="easyui-textbox" type="text" id="DMaterialNO" data-options="prompt:'请输入物料编号'" style="width: 350px; height: 35px; line-height: 35px;" /></li>
                <li>
                    <input class="easyui-textbox" type="text" id="DMaterialName" data-options="prompt:'请输入物料名称'" style="width: 350px; height: 35px; line-height: 35px;" />
                    <a href="javascript:void(0)" id="DMSearch" class="easyui-linkbutton c1" onclick="MaterialLocal()" data-options="iconCls:'icon-sousuo',selected:true">查询</a>
                </li>
            </ul>
        </div>
        <div class="cbox">
            <!--查询结果清单-->
            <table id="tts">
            </table>
        </div>
    </div>

    <%--    合作伙伴dialog--%>
    <div id="PartnerDialog" class="easyui-dialog" title="Vendor List" style="min-width: 700px; min-height: 560px; padding: 5px"
data-options="closed:true,modal:true,resizable:true">
        <div class="cbox">
            <ul class="flist">
                <li>
                    <input class="easyui-textbox" type="text" id="DPartnerNO" data-options="prompt:''" style="width: 350px; height: 35px; line-height: 35px;" /></li>

                <li>
                    <input class="easyui-textbox" type="text" id="DPartnerName" data-options="prompt:''" style="width: 350px; height: 35px; line-height: 35px; white-space: nowrap; display: inline-block; overflow: visible;" />
                    <a href="javascript:void(0)" class="easyui-linkbutton c1" onclick="TPartnerLocal()" id="Dsearch" data-options="iconCls:'icon-sousuo',selected:true">查询</a>
                </li>
            </ul>
        </div>
        <div class="cbox">
            <!--查询结果清单-->
            <table id="ttsd">
            </table>
        </div>
    </div>
    <%--   收料单生成dialog--%>
    <div id="SLDialog" class="easyui-dialog" title="Reciving Order List" style="width: 900px; height: 530px; padding: 5px"
data-options="closed:true,modal:true,resizable:true">
        <div class="cbox">
            <ul class="flist">
                <li>
                    <input class="easyui-textbox" type="text" id="SReciveOrderNO" data-options="prompt:'请输入单据编号'" style="width: 150px; height: 35px; line-height: 35px;" /></li>
                <li>
                    <input class="easyui-textbox" type="text" id="SPartnerNO" data-options="prompt:'请输入供应商信息'" style="width: 150px; height: 35px; line-height: 35px;" />
                    <a href="javascript:void(0)" class="easyui-linkbutton c1" id="SLSearch" onclick="SLLocal()" data-options="iconCls:'icon-sousuo',selected:true">查询</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton c2" id="SLSave" onclick="Auto_Lable()" data-options="iconCls:'icon-baocun',selected:true">批量生成标签</a>
                </li>
            </ul>
        </div>
        <div class="cbox">
            <!--查询结果清单-->
            <table id="SL">
            </table>
        </div>
    </div>

    <%--   补打生成dialog--%>
    <div id="CodeDialog" class="easyui-dialog" title="Barcode List"
        style="width: 900px; height: 460px; padding: 5px"
        data-options="closed:true,modal:true,resizable:true">
        <ul class="flist">
            <li style="margin-bottom: 15px; padding-left: 10px;">
                <input class="easyui-textbox" type="text" id="FBarcodeNO" data-options="label:'条码编号:'" style="width: 250px; height: 35px; line-height: 35px;" /></li>
            <li style="margin-bottom: 15px; padding-left: 10px;">
                <input class="easyui-textbox" type="text" id="FPartnerNO" data-options="label:'供应商信息:'" style="width: 250px; height: 35px; line-height: 35px;" /></li>
            <li style="margin-bottom: 15px; padding-left: 10px;">
                <input class="easyui-textbox" type="text" id="FSourceOrderNO" data-options="label:'收料单号:'" style="width: 250px; height: 35px; line-height: 35px;" />
            </li>
            <li style="margin-bottom: 15px; padding-left: 10px;">
                <input class="easyui-textbox" type="text" id="FMaterialNO" data-options="label:'物料编号:'" style="width: 250px; height: 35px; line-height: 35px;" />
            </li>
            <li style="margin-bottom: 15px; padding-left: 10px;">
                <input class="easyui-textbox" type="text" id="FMaterialName" data-options="label:'物料名称:'" style="width: 250px; height: 35px; line-height: 35px;" />
                <a href="javascript:void(0)" class="easyui-linkbutton c1" onclick="CodeLocal()" id="FSearch" data-options="iconCls:'icon-sousuo',selected:true">查询</a>
                &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp   &nbsp  
                  <a href="javascript:void(0)" class="easyui-linkbutton c2" onclick="Print_Lable()" id="FPrint" data-options="iconCls:'icon-baocun',selected:true">打印</a>
            </li>
        </ul>
        <div class="cbox">
            <!--查询结果清单-->
            <table id="barCode">
            </table>
        </div>
    </div>
</body>

</html>
